#!/bin/bash

USAGE="Usage: setup-nfqueue LOCAL_IP:LOCAL_PORT REMOTE_IP:REMOTE_PORT"

if [ $# -ne 2 ]; then
    echo $USAGE 2>&1
    exit 1
fi

LIP=${1%:*}
LPORT=${1#*:}
RIP=${2%:*}
RPORT=${2#*:}

iptables -I INPUT 1 -s $RIP -d $LIP -p tcp --sport $RPORT --dport $LPORT -j QUEUE
iptables -I OUTPUT 1 -s $LIP -d $RIP -p tcp --sport $LPORT --dport $RPORT -j QUEUE
